const {orderFormatError} = require('../constant/err.type')
const Validator = (rules)=>{
    return async (ctx,next)=>{
        try {
            ctx.verifyParams(rules)
        } catch (error) {
            console.log(error);
            orderFormatError.result = error
            ctx.app.emit('error',orderFormatError,ctx)
        }
        await next()
    }
}

module.exports = {
    Validator
}